package com.yunxin.core.infra.persistence.repository.contact;

import com.yunxin.core.domain.model.contact.ContactMessageSendTaskDetail;
import com.yunxin.core.domain.model.contact.ContactMessageSendTaskDetailRepository;
import com.yunxin.core.infra.persistence.converter.ContactConverter;
import com.yunxin.core.infra.persistence.entity.contact.ContactMessageSendTaskDetailDO;
import com.yunxin.core.infra.persistence.mapper.contact.ContactMessageSendTaskDetailExtendMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zero°
 * @since 2023-07-12
 */
@Repository
@RequiredArgsConstructor
public class ContactMessageSendTaskDetailRepositoryImpl implements ContactMessageSendTaskDetailRepository {

    private final ContactMessageSendTaskDetailExtendMapper contactMessageSendTaskDetailExtendMapper;

    private final ContactConverter contactConverter;
    @Override
    public List<ContactMessageSendTaskDetail> listMessageSendTaskDetailByTaskCode(String taskCode) {
        List<ContactMessageSendTaskDetailDO> list = contactMessageSendTaskDetailExtendMapper.selectMessageSendTaskDetailByTaskCode(taskCode);
        return list.stream().map(contactConverter::toContactMessageSendTaskDetail).toList();
    }
}
